def taxi(dist: list, cost: list) -> int:
    dist.sort(reverse=True)
    cost.sort()
    sum1 = 0
    for index, value in enumerate(dist):
        sum1 += value * cost[index]
    return sum1

assert taxi([10,20,30], [50,20,30]) == 1700
assert taxi([30,10,100,20,50], [100,30,50,20,15]) == 5400

